//医保付款单
app.controller('btnCtrl', ['$scope', '$http', BtnController]);
function BtnController($scope, $http){

    $scope.bindBtn = function(event) {
        var datas = $scope.getSelectedRows();
        switch(event){
            case 'LAYTABLE_EXPORT_DATA':
            {
                $scope.doExport('/api/inter/tbMedicarePay/export');
                break;
            }
            case 'event-to-add':
            {
                window.top.add_tab("医保付款单 - 新增","/web/base/tbMedicarePay/toAdd",1);
                break;
            }
            case 'LAYTABLE_EXPORT_DATA_DY':
            {
                if(datas.length == 0) {
                    layer.alert('尚未选中数据');
                } else if(datas.length > 1) {
                    layer.alert('只能选中一行数据');
                } else {
                    $scope.doExport('/api/inter/tbMedicarePay/exportdy?bid=' + datas[0].bid);
                }
                break;
            }
            case 'LAYTABLE_EXPORT_DATA_DYMX':
            {
                if(datas.length == 0) {
                    layer.alert('尚未选中数据');
                } else if(datas.length > 1) {
                    layer.alert('只能选中一行数据');
                } else {
                    $scope.doExport('/api/inter/tbMedicarePay/exportdymx?bid=' + datas[0].bid);
                }
                break;
            }
        };
    }
}


//表格双击
app.controller('dbClickCtrl', ['$scope', '$http', DbClickController]);
function DbClickController($scope, $http){
    $scope.doubleClick = function(data) {
        window.top.add_tab('医保付款单 - 编辑','/web/base/tbMedicarePay/toEdit?bid=' + data.bid);
    }
}

